package com.mark.controller;

import com.mark.entity.Order;
import com.mark.service.OrderService;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author: yangguoxiong
 * @date: 2023/11/19 20:38
 * @description:
 */
@RequiredArgsConstructor
@RestController(value = "sharding")
@RequestMapping("/sharding")
public class ShardingJdbcController {

    private final OrderService orderService;

    @GetMapping("/transactionalInsert")
    public Order transactionalInsert() {
        return orderService.transactionalInsertAndQuery();
    }

    @GetMapping("/transactionalQuery")
    public Order transactionalQuery() {
        return orderService.testTransactionSingleQuery();
    }

    @GetMapping("/normalQuery")
    public Order normalQuery() {
        return orderService.normalQuery();
    }
}
